﻿@{
    ViewBag.Title = "Node";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@model Webdiyer.WebControls.Mvc.PagedList<OneStationFile.Model.Node>
    @using Webdiyer.WebControls.Mvc;
    <div id="page-wrapper">
        <div class="row" >
            <h2 class="page-header">模块管理-节点</h2>
            <div style="float:right;margin-right:15px">
                <a class="btn btn-outline btn-info btn-sm" href="/Modular" >返回</a>
               
            </div>
        </div>
        <!-- /.row -->
        <!-- /.row -->
        <div class="row">

            <!-- /.col-lg-6 -->
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <nav class="navbar navbar-default" role="navigation">
                        <div class="container-fluid">
                            <div class="navbar-header">
                                <h3 style="margin:10px,0px,20px">条件筛选</h3>
                            </div>
                            
                        </div>
                        <div class="container-fluid">
                            <div class="navbar-header">
                                <button type="button" onclick="Add()" class="btn btn-default navbar-btn">
                                    添加
                                </button>
                            </div>

                        </div>
                        
                    </nav>
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <div class="table-responsive">
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>名称</th>
                                        <th>地址</th>
                                        <th>控制器</th>
                                        <th>方法</th>
                                        <th>是否显示</th>
                                        <th>等级</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @{ int i = 0;}
                                    @foreach (var item in Model)
                                    {
                                    <tr class="success">
                                        <td>@(++i)</td>
                                        <td>
                                            @item.Name
                                        </td>
                                        <td>@item.Url</td>
                                        <td>@item.Controller</td>
                                        <td>@item.Action</td>
                                        <td>@item.IsShow</td>
                                        <td>@item.NodeLevelD</td>
                                        <td>
                                            <a href="javascript:Delete(@item.Id)">删除</a>
                                        </td>
                                    </tr>
                                    }






                                </tbody>
                            </table>
                            @Html.Pager(Model, new PagerOptions { PageIndexParameterName = "page", NumericPagerItemCount = 5, ContainerTagName = "ul", CssClass = "pagination", CurrentPagerItemTemplate = "<li class=\"active\"><a href=\"#\">{0}</a></li>", DisabledPagerItemTemplate = "<li class=\"disabled\"><a>{0}</a></li>", PagerItemTemplate = "<li>{0}</li>", Id = "pager2", PageIndexBoxId = "pageIndexBox", GoToButtonId = "goToBtn", NavigationPagerItemsPosition = PagerItemsPosition.Left })
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-6 -->
        </div>
        <!-- /.row -->
    </div>


    @section scripts{
    <script>
        //添加节点
        function Add() {
            art.dialog.open("/Modular/FreeNodes?id=@Request["id"]", { id: 'memdiv', width: 900, height: 500, title: '添加节点' });
        }
        //end
        //删除用户
        function Delete(nodeId) {
            art.dialog.confirm('你确定要删除这条消息吗？', function () {
                $.post("/Modular/DeleteNode", { id: @Request["id"], nodeId: nodeId }, function (result) {

                    art.dialog.tips(result.msg);
                    if (result.res == true) {
                        setTimeout(function () { window.location.reload() }, 1000);
                    }
                }, "json");
            }, function () {
                art.dialog.tips('用户取消了操作');
            });

        }
        //end
    </script>
    }

